import type {App} from 'vue';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import VInput from './base/v-input.vue'
import VButton from './base/v-button.vue'
import VUpload from "./base/v-upload.vue";
import VDatePicker from "./base/v-date-picker.vue";
import SearchPanel from './search-panel/search-panel.vue'
import TablePanel from './table-panel/table-panel.vue'
import List from './list/list.vue'
import FormPanel from './form-panel/form-panel.vue'
import {ElMessage} from 'element-plus'

//全局对象
const allGlobalComponent: any = {VInput, VButton, VDatePicker, VUpload, SearchPanel, TablePanel, List, FormPanel}

export {ElMessage}

export default {
    //务必叫做install方法
    install(app: App) {
        //将element-plus提供图标注册为全局组件
        for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
            app.component(key, component)
        }
        //注册项目全部的全局组件
        Object.keys(allGlobalComponent).forEach((key) => {
            //注册为全局组件
            app.component(key, allGlobalComponent[key])
        })
    }
}
